package com.exam.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.exam.entity.Product;
import com.exam.mapper.ProductMapper;
import com.exam.service.ProductService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author chenzhuo
 * @since 2023-02-04 05:24:05
 */
@Service
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements ProductService {
    @Autowired
    ProductMapper productMapper;
    @Override
    public Page<Product> getPageProduct(Integer currentPage, Integer pageSize, String keyword) {
        Page<Product> Page = new Page<>(currentPage,pageSize);
        //查询条件
        QueryWrapper<Product> bookQueryWrapper = new QueryWrapper<>();
        bookQueryWrapper.like("productname",keyword);
        Page<Product> PageResult = productMapper.selectPage(Page,bookQueryWrapper);
        return PageResult;
    }
}
